package init

import (
	"api_gateway/basic/config"
	background "api_gateway/basic/proto/background"
	"flag"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"log"
)

// 初始化后台服务的gRPC客户端
func InBackgroundGrpc() {
	flag.Parse()
	conn, err := grpc.NewClient("127.0.0.1:50053", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}

	config.BackgroundClient = background.NewBackgroundClient(conn)
}
